package cn.qyd.other;

import com.google.common.collect.Maps;

import java.sql.*;
import java.util.HashMap;
import java.util.Random;


/**
 * @author 邱运铎
 * @date 2024-04-02 22:45
 */
public class AssertDemo {
    public static void main(String[] args) throws Exception{

        System.out.println(3 & 1);
        System.out.println(2 & 1);
        System.out.println(3 | 5);

        int num = 3;
        assert num > 2 : "num必须大于5";
        System.out.println("通过断言");
        Random random =new Random();
        int i = random.nextInt(2);
        System.out.println(i);
        Class.forName("com.mysql.jdbc.driver");
        Connection connection = DriverManager.getConnection("127.0.0.1:3306/pai_coding", "root", "root");
        PreparedStatement preparedStatement = connection.prepareStatement("select * from article where id = ?");
        preparedStatement.setInt(1,1);

        ResultSet resultSet = preparedStatement.executeQuery();
        while (resultSet.next()){
            System.out.println(resultSet.getString("name"));
        }
    }
}
